use qputenv to modify the running process environment
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 12 Feb 2025 08:53:07 +0000 (09:53 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 12 Feb 2025 08:54:38 +0000 (09:54 +0100)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/gui/application.cpp

index 2ac79a20eaac7bdd3942a2205a81c03ac770d60c..6c00e6b6d745d4f5c6ebc8dbdea1600f2ce013fd 100644 (file)
@@ -234,12 +234,11 @@ Application::Application(int &argc, char **argv)
     qputenv("OPENSSL_CONF", opensslConf.toLocal8Bit());
 
     const auto shouldDisableGraphicsAcceleration = [&]() {
-        const auto systemEnvironment = QProcessEnvironment::systemEnvironment();
-        if (systemEnvironment.contains(QStringLiteral("VMWARE"))) {
+        if (qEnvironmentVariableIsSet("VMWARE")) {
             return true;
         }
 
-        if (systemEnvironment.contains("SESSIONNAME") && systemEnvironment.value("SESSIONNAME").startsWith("RDP-")) {
+        if (qEnvironmentVariableIsSet("SESSIONNAME") && qEnvironmentVariable("SESSIONNAME").startsWith("RDP-")) {
             return true;
         }
 
@@ -247,7 +246,7 @@ Application::Application(int &argc, char **argv)
     };
 
     if (shouldDisableGraphicsAcceleration()) {
-        QProcessEnvironment::systemEnvironment().insert(QStringLiteral("SVGA_ALLOW_LLVMPIPE"), 0);
+        qputenv("SVGA_ALLOW_LLVMPIPE", 0);
         qCInfo(lcApplication) << "Disabling graphics acceleration, application might be running in a virtual or in a remote desktop.";
     }
 #endif